// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import Axios from 'axios'
// 引入mintUi
import MintUI from 'mint-ui'
import 'mint-ui/lib/style.css'
// 引入mintUi的css样式
import '../static/vendor/mui/dist/css/mui.min.css'

Vue.use(MintUI)
Vue.prototype.$axios = Axios

Vue.config.productionTip = false

// 拦截器
Axios.defaults.headers = {
  accept: 'interceptors'
}

// 拦截器(请求)
Axios.interceptors.request.use(function(config) {
  console.log(config);
  // config.headers.accept = 'interceptors';
  config.headers = {
    accept: 'interceptors'
  }
  // 返回没有修改的配置(如果不想发起请求的话，直接将return代码不返回就好了，或者直接return false)
  return config;
})
// 拦截器（响应）
Axios.interceptors.response.use(function(config){
  // 响应回来Loading
  console.log(config);
  return config;
})

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})
